﻿//********************************************************************************//
//创建日期：<创建日期，2010-08-02>
//创建作者：<王一飞，wangyifei@shanghai3h.com>
//功能说明：YS_JH_YUBIANZJHPZBLL层
//********************************************************************************//
namespace BLL
{
    using System;
    using System.Data;
    using Access;
    public class YS_JH_YUBIANZJHPZBLL : YS_JH_YUBIANZJHPZProcess
    {
        #region Field
        private string ConnectionString;
        #endregion
        #region Construction
        public YS_JH_YUBIANZJHPZBLL()
        {
            ConnectionString = base.conn;
        }
        #endregion

        #region Method

        /// <summary>
        /// 更新确定方案
        /// </summary>
        /// <param name="benbuqdfn">本部确定方案</param>
        /// <param name="banshicqdfn">办事处确定方案</param>
        /// <param name="y">水量年</param>
        public void UpdateQDFN(int benbuqdfn, int banshicqdfn, string y)
        {
            System.Text.StringBuilder updateSql = new System.Text.StringBuilder();
            updateSql.Append("S_BENBUQDFN='").Append(benbuqdfn).Append("'");
            updateSql.Append(",S_BANSHICQDFN='").Append(banshicqdfn).Append("'");
            updateSql.Append(",S_DAGNQIANBZ='1'");
            this.UpdateYS_JH_YUBIANZJHPZsDynamic(updateSql.ToString(), "I_Y=" + y);
        }

        public void UpdateYuBianZJHPZ(string BanShiCFangA, string BANSHICXX, string BenBuFangA, string BENBUXX, string BENNIANQ, string CHAOJIHTJD,
                                       string CHAOJIHTJG, string CHAOJIHTJZ, string CHAOJIHTJSX, string CHAOYONGLSX, string CHAOYONGLTJ, string CHAOYONGLYS,
                                        string CHAOYONGLYZ, string FULIWCL, string FULIWCLXX, string JIAJIABL, string JINNIANQ, string QIANNIANQ, 
                                        string QUNIANQ, string SHANGNIANQ,string WANCHENGLTJ, string WANCHENGLXX, string WANCHENGLYS, string WANCHENGLYZ, 
                                        string Y, string M, string CaoZuoR, DateTime CaoZuoSJ)
        {
            Entity.YS_JH_YUBIANZJHPZ pz = new Entity.YS_JH_YUBIANZJHPZ();
            //判断是否存在该年预编制计划参数,不存在则添加
            DataRowCollection drc = this.SelectYS_JH_YUBIANZJHPZsDynamic("I_Y="+Y,null).Rows;
            if (drc.Count == 1)
            {
                pz.ID = Convert.ToDecimal(drc[0]["ID"]);
            }
            else
            {
                pz.ID = 0;
            }
            pz.I_Y = Convert.ToDecimal(Y);
            pz.S_BANSHICFN = BanShiCFangA;
            pz.S_BANSHICXX = BANSHICXX;
            pz.S_BENBUFN = BenBuFangA;
            pz.S_BENBUXX = BENBUXX;
            pz.S_BENNIANQ = BENNIANQ;
            pz.S_CHAOJIHTJD = CHAOJIHTJD;
            pz.S_CHAOJIHTJG = CHAOJIHTJG;
            pz.S_CHAOJIHTJZ = CHAOJIHTJZ;
            pz.S_CHAOJIHTJSX = CHAOJIHTJSX;
            pz.S_CHAOYONGLSX = CHAOYONGLSX;
            pz.S_CHAOYONGLTJ = CHAOYONGLTJ;
            pz.S_CHAOYONGLYS = CHAOYONGLYS;
            pz.S_CHAOYONGLYZ = CHAOYONGLYZ;
            pz.S_FULIWCL = FULIWCL;
            pz.S_FULIWCLXX = FULIWCLXX;
            pz.S_JIAJIABL = JIAJIABL;
            pz.S_JINNIANQ = JINNIANQ;
            pz.S_QIANNIANQ = QIANNIANQ;
            pz.S_QUNIANQ = QUNIANQ;
            pz.S_SHANGNIANQ = SHANGNIANQ;
            pz.S_WANCHENGLTJ = WANCHENGLTJ;
            pz.S_WANCHENGLXX = WANCHENGLXX;
            pz.S_WANCHENGLYS = WANCHENGLYS;
            pz.S_WANCHENGLYZ = WANCHENGLYZ;
            pz.I_YUCEN = Convert.ToInt32(Y);
            pz.I_YUCEY = Convert.ToInt32(M);
            pz.S_CAOZUOR = CaoZuoR;
            pz.D_CAOZUOSJ = CaoZuoSJ;
            pz.S_DAGNQIANBZ = "1";
            this.InsertOrUpdate(pz);
            //System.Text.StringBuilder updateSql = new System.Text.StringBuilder();
            //updateSql.Append("S_BANSHICFN='").Append(BanShiCFangA).Append("'").Append(",S_BANSHICXX='").Append(BANSHICXX).Append("'");
            //updateSql.Append(",S_BENBUFN='").Append(BenBuFangA).Append("'").Append(",S_BENBUXX='").Append(BENBUXX).Append("'");
            //updateSql.Append(",S_BENNIANQ='").Append(BENNIANQ).Append("'").Append(",S_CHAOJIHTJD='").Append(CHAOJIHTJD).Append("'");
            //updateSql.Append(",S_CHAOJIHTJG='").Append(CHAOJIHTJG).Append("'").Append(",S_CHAOJIHTJZ='").Append(CHAOJIHTJZ).Append("'");
            //updateSql.Append(",S_CHAOJIHTJSX='").Append(CHAOJIHTJSX).Append("'").Append(",S_CHAOYONGLSX='").Append(CHAOYONGLSX).Append("'");
            //updateSql.Append(",S_CHAOYONGLTJ='").Append(CHAOYONGLTJ).Append("'").Append(",S_CHAOYONGLYS='").Append(CHAOYONGLYS).Append("'");
            //updateSql.Append(",S_CHAOYONGLYZ='").Append(CHAOYONGLYZ).Append("'").Append(",S_FULIWCL='").Append(FULIWCL).Append("'");
            //updateSql.Append(",S_FULIWCLXX='").Append(FULIWCLXX).Append("'").Append(",S_JIAJIABL='").Append(JIAJIABL).Append("'");
            //updateSql.Append(",S_JINNIANQ='").Append(JINNIANQ).Append("'").Append(",S_QIANNIANQ='").Append(QIANNIANQ).Append("'");
            //updateSql.Append(",S_QUNIANQ='").Append(QUNIANQ).Append("'").Append(",S_SHANGNIANQ='").Append(SHANGNIANQ).Append("'");
            //updateSql.Append(",S_WANCHENGLTJ='").Append(WANCHENGLTJ).Append("'").Append(",S_WANCHENGLXX='").Append(WANCHENGLXX).Append("'");
            //updateSql.Append(" ,S_WANCHENGLYS='").Append(WANCHENGLYS).Append("'").Append(",S_WANCHENGLYZ='").Append(WANCHENGLYZ).Append("'");
            //updateSql.Append(",I_YUCEN=").Append(Y).Append(",I_YUCEY=").Append(M);

            //updateSql.Append(",S_CAOZUOR='").Append(CaoZuoR).Append("'").Append(",D_CAOZUOSJ=to_date('").Append(CaoZuoSJ.ToString()).Append("',").Append("'yyyy_MM_dd HH24:mi:ss')");
            //更新参数
            //this.UpdateYS_JH_YUBIANZJHPZsDynamic(updateSql.ToString(), "I_Y=" + Y);
        }

        #endregion
    }
}